import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:management/model/department_model.dart';
import 'package:management/model/visit_matter_model.dart';
import 'package:management/utils/custom_router.dart';
import 'package:management/views/mine/setting/set_visit_matters.dart';

import 'set_department_interviewed.dart';
import 'set-registration-point.dart';

///设置
class Setting extends StatefulWidget {
  @override
  _SettingState createState() => _SettingState();
}

class _SettingState extends State<Setting> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  AppBar? _buildAppBar() {
    return AppBar(
      // backgroundColor: Color(0x1FFFFFFF), //Color(0x1FFFFFFF)
      leading: IconButton(
        icon: Icon(
          Icons.arrow_back,
          size: 35,
        ),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
      title: Text(
        "设置",
        style: TextStyle(
          fontSize: 30,
          color: Colors.white,
        ),
      ),
      centerTitle: true,
    );
  }

  Widget _buildBody() {
    return Container(
      padding: EdgeInsets.all(10),
      child: Column(
        children: [
          ListTile(
            title: const Text(
              "修改被访部门",
              style: const TextStyle(
                fontSize: 25,
              ),
            ),
            trailing: const Icon(Icons.arrow_forward_ios_rounded),
            onTap: () async {
              Navigator.push(
                context,
                SlideRoute(
                  SetDepartment(
                    departmentSource: await DepartmentProvider().queryAll(),
                  ),
                ),
              );
            },
          ),
          Divider(),
          ListTile(
              title: const Text(
                "修改来访事项",
                style: const TextStyle(fontSize: 25),
              ),
              trailing: const Icon(Icons.arrow_forward_ios_rounded),
              onTap: () async {
                Navigator.push(
                  context,
                  SlideRoute(
                    SetVisitMatters(
                      matterSource: await VisitMatterProvider().queryAll(),
                    ),
                  ),
                );
              }),
          Divider(),
          ListTile(
            title: const Text(
              "修改登记点",
              style: const TextStyle(fontSize: 25),
            ),
            trailing: const Icon(Icons.arrow_forward_ios_rounded),
            onTap: () =>
                Navigator.push(context, SlideRoute(SetRegistrationPoint())),
          ),
          Divider()
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: _buildAppBar(),
      body: _buildBody(),
    );
  }
}
